# Define the `OE_SGX` macro used by the oeedger8r on the SGX build.
if (OE_SGX)
  set(DEFINE_OE_SGX "-DOE_SGX" --search-path ${PROJECT_SOURCE_DIR}/ert/include
                    --search-path ${OEBUILDDIR}/openenclave-install/include)
endif ()

set(DEFAULT_TEST_ENCLAVE_CRYPTO_LIB "mbedtls")
include(${OESRCDIR}/cmake/enclave_cmake_wrappers.cmake)
include(${OESRCDIR}/cmake/add_enclave.cmake)

# add_enclave() links its target against oeenclave and oecryptombedtls. Add helper interface libraries for that.
add_library(oeenclave INTERFACE)
target_link_libraries(oeenclave INTERFACE openenclave::oeenclave)
add_library(oecryptombedtls INTERFACE)
target_link_libraries(oecryptombedtls INTERFACE openenclave::oecryptombedtls)

add_subdirectory(args)
add_subdirectory(bitset)
add_subdirectory(concurrent_stdout)
add_subdirectory(customentry)
add_subdirectory(customfs)
add_subdirectory(deventry)
add_subdirectory(eventfd)
add_subdirectory(executable_heap)
add_subdirectory(go)
add_subdirectory(go_net)
add_subdirectory(go_ra)
add_subdirectory(go_seal)
add_subdirectory(host)
add_subdirectory(libc)
add_subdirectory(libc_whole_archive)
add_subdirectory(lingering_threads)
add_subdirectory(mman)
add_subdirectory(memfs)
#add_subdirectory(mmapfs)
#add_subdirectory(mmapfs2)
#add_subdirectory(mmapfs3)
add_subdirectory(meshentry_go_app)
add_subdirectory(meshentry_nongo_app)
add_subdirectory(meshentry_premainmock)
add_subdirectory(misc_syscalls)
add_subdirectory(payload_data)
add_subdirectory(payload_image)
add_subdirectory(payload_tls)
add_subdirectory(pthread_create)
add_subdirectory(restart)
add_subdirectory(ringbuffer)
add_subdirectory(sem)
add_subdirectory(signal)
add_subdirectory(stdcpp)
add_subdirectory(stdcxx)
add_subdirectory(template)
add_subdirectory(threadcpp)
add_subdirectory(threadcxx)
add_subdirectory(thread_join_on_exit)
add_subdirectory(trace_ocalls)
add_subdirectory(ttls)
add_subdirectory(util)
